package the.guanzhong.express.interfaces.controller;

import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wisteria.framework.web.APIResult;
import the.broccoli.setting.service.IParamsService;
import the.guanzhong.express.interfaces.controller.resp.MerchantInfoResp;

import javax.annotation.Resource;

/**
 * 门店信息控制器
 */
@Api(tags = "Express")
@Slf4j
@RestController
@RequestMapping("/express/merchant")
public class ExpressMerchantController {

    @Resource
    private IParamsService paramsService;

    /**
     * 门店详情
     * @return
     */
    @GetMapping("/info")
    public APIResult<MerchantInfoResp> getMerchantInfo() {
        MerchantInfoResp resp = null;
        String content = paramsService.getValue("EXPRESS_MERCHANT");
        if (StringUtils.hasText(content)) {
            resp = JSON.parseObject(content, MerchantInfoResp.class);
        }
        return APIResult.success(resp);
    }

}
